package demoMod.nanaki.relics;

import basemod.abstracts.CustomRelic;
import com.badlogic.gdx.graphics.Texture;
import com.megacrit.cardcrawl.actions.common.RelicAboveCreatureAction;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import demoMod.nanaki.NanakiMod;
import demoMod.nanaki.actions.StruckUpAction;
import demoMod.nanaki.stances.AbstractStrophe;
import demoMod.nanaki.utils.GetWaitAction;

public class SoulCallingSong extends CustomRelic {
    public static final String ID = NanakiMod.makeID("SoulCallingSong");
    public static final Texture IMG = new Texture(NanakiMod.getResourcePath("relics/SoulCallingSong.png"));
    public static final Texture IMG_OUTLINE = new Texture(NanakiMod.getResourcePath("relics/SoulCallingSong_outLine.png"));

    public SoulCallingSong() {
        super(ID, IMG, IMG_OUTLINE, RelicTier.BOSS, LandingSound.CLINK);
    }

    @Override
    public String getUpdatedDescription() {
        return DESCRIPTIONS[0];
    }

    @Override
    public void obtain() {
        this.instantObtain(AbstractDungeon.player, 0, true);
        this.flash();
    }

    @Override
    public void atTurnStartPostDraw() {
        addToBot(GetWaitAction.doAndWait(() -> {
            AbstractPlayer p = AbstractDungeon.player;
            if (!(p.stance instanceof AbstractStrophe)) {
                this.flash();
                addToTop(new StruckUpAction());
                addToTop(new RelicAboveCreatureAction(AbstractDungeon.player, this));
            }
        }, 0.0F));
    }

    @Override
    public boolean canSpawn() {
        return AbstractDungeon.player.hasRelic(TheBell.ID);
    }

    @Override
    public void playLandingSFX() {
        CardCrawlGame.sound.play("TINGSHA");
    }
}
